package com.feihong.txgw.tx_model;

import com.feihong.txgw.inter.contract.product.IProSearchContract;
import com.feihong.txgw.model.bean.searchList.SearchPhoneListModel;
import com.feihong.txgw.utils.helper.RxHelper;
import com.feihong.txgw.utils.manage.RetrofitManager;

import java.util.HashMap;
import java.util.Map;

import io.reactivex.Observable;

/**
 * @Author wangziheng
 * @ProjectName txgw_app
 * @ClassName ProSearchMainModel
 * @package com.feihong.txgw.tx_model
 * @data 2018/5/8 11:19
 * @Describe
 * @Change
 */
public class ProSearchMainModel implements IProSearchContract.IProSearchMainModel {
    @Override
    public Observable<SearchPhoneListModel> getGoodsData(String lat, String lng, String keyWord, String searchType,int pageNum) {
        Map<String,String> mParams = new HashMap<>();
        mParams.put("lat",lat);
        mParams.put("lng",lng);
        mParams.put("keyword",keyWord);
        mParams.put(searchType,String.valueOf(pageNum));
        return RetrofitManager.getInstance().getSearchGoodsOrStore(mParams).compose(RxHelper.<SearchPhoneListModel>rxSchedulerHelper());
    }

    public static ProSearchMainModel create(){
        return new ProSearchMainModel();
    }
}
